package com.ces.knacky.controller.tools;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ces.knacky.framework.controller.BaseController;
import com.ces.knacky.model.Brand;

@Controller
public class CreateItemController extends BaseController {
	
	private List<Brand> brandList;
	
	
	
	/*
	 <div dojoType="dijit.form.TextBox" title="Name:" id="name" required="true"></div>
	    <div dojoType="dijit.form.TextBox" title="Description:" id="description" required="true"></div>
	    <div dojoType="dijit.form.TextBox" title="Expected Price:" id="expectedPrice" required="true"></div>
		<div dojoType="dojox.form.DropDownSelect" title="Parent:" id="parent"></div>
		<div dojoType="dojox.form.DropDownSelect" title="Belongs to:" id="company" ></div>
		<div dojoType="dojox.form.DropDownSelect" title="Brand:" id="brand" store="brandStore"></div>
		<div dojoType="dojox.form.DropDownSelect" title="Category:" id="category"></div>
	*/
	@RequestMapping("/createItem.htm")
	public String execute() {
		System.out.println("Create Items...");
		populateForm();
		return "createItem";
	}
	
	public void populateForm() {
		brandList = (List<Brand>) commonService.list("Select brand from Brand brand");		
	}

	/**
	 * @return the brandList
	 */
	@ModelAttribute("brandList")
	@RequestMapping("/populateBrand.htm")
	public List<Brand> getBrandList() {
		return brandList;
	}

		/**
	 * @param brandList the brandList to set
	 */
	public void setBrandList(List<Brand> brandList) {
		this.brandList = brandList;
	}
	
}
